<template>
	<view>
		<match-media :min-width="MAX_SIZEiZE - 1" class="nav-box">
			<view class="pc-back" @click="clickLeft">
				<view class="back-cont cursor ">
					<view class="back-icon"> </view>
					<view class="back-text"> {{$t('Page.notify.back')}} </view>
				</view>
				<text class="page-title">{{pageName}}</text>
			</view>
			<view class="pc-right">
				<slot name="right"></slot>
			</view>
		</match-media>
	</view>
</template>

<script>
	import {
		MAX_SIZEiZE
	} from '@/common/app.js'
	export default {
		name: "pcNavBar",
		data() {
			return {
				MAX_SIZEiZE
			};
		},
		props: {
			pageName: {
				type: String,
				default: ''
			},
			goBack: {
				type: Function
			}
		},

		methods: {
			clickLeft() {
				if (typeof this.goBack === 'function') {
					this.goBack()
				} else {
					const canNavBack = getCurrentPages();
					if (canNavBack && canNavBack.length > 1) {
						uni.navigateBack({
							delta: 1
						});
					} else {
						history.back();
					}
				}
			},
		}

	}
</script>

<style lang="scss">
	.nav-box {
		display: flex;
		justify-content: space-between;
		height: 60px;
		align-items: center;
		background: var(--bg-24);
		border-radius: 30px;
		padding: 0 30px;
	}

	.pc-back {
		display: flex;
		align-items: center;
		box-sizing: border-box;

		.back-cont {
			display: flex;
			align-items: center;
			height: 30px;
			padding: 0 10px;
			border-radius: 100px;
			background: var(--bg-25);

			.back-icon {
				width: 13px;
				height: 11px;
				background: url('@/static/image/back-icon.png') no-repeat;
				background-size: contain;
			}

			.back-text {
				font-size: 13px;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 18px;
				margin-left: 5px;
			}
		}

		.page-title {
			font-size: 20px;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			width: fit-content !important;
			margin-left: 15px;
		}
	}
</style>